package com.pti.usermanager.dao.impl;

import com.pti.usermanager.dao.api.OrgDao;
import com.pti.usermanager.dao.mapper.OrgMapper;
import com.pti.usermanager.dao.po.OrgPo;
import com.pti.usermanager.web.dto.request.SaveOrgRequest;
import com.pti.usermanager.web.dto.request.UpdateOrgRequest;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: OrgDaoImpl
 * @Author: mahuilin
 * @Description: 组织数据交换实现层
 * @Date: 2019/2/20
 */
@Repository
public class OrgDaoImpl implements OrgDao{

    private static final Logger logger = LogManager.getLogger(OrgDaoImpl.class);

    @Autowired
    private OrgMapper orgMapper;

    @Override
    public String findRoleByUsrId(Long usrId) {
        return orgMapper.findRoleByUsrId(usrId);
    }

    @Override
    public List<OrgPo> findOrgTreeByUsrRole(Map<String, Object> inputMap){
        return orgMapper.findOrgTreeByUsrRole(inputMap);
    }

    @Override
    public void saveOrg(SaveOrgRequest saveOrgRequest) {
        orgMapper.saveOrg(saveOrgRequest);
    }

    @Override
    public void delOrg(Long orgId) {
        orgMapper.delOrg(orgId);
    }

    @Override
    public void updateOrg(UpdateOrgRequest updateOrgRequest) {
        orgMapper.updateOrg(updateOrgRequest);
    }
}

